# -*- coding: utf-8 -*-
"""
Created on Sun Sep 21 15:54:14 2025

@author: lenovo
"""

class Book:
    
    def __init__(self, title, author, year):
        self.title = title
        self.author = author
        self.year = year

    def display_info(self):
        print(f"书名: {self.title}")
        print(f"作者: {self.author}")
        print(f"出版年份: {self.year}")


book1 = Book("Python编程从入门到实践", "Eric Matthes", 2016)
book2 = Book("三国演义", "罗贯中", "元末明初")

book1.display_info()
book2.display_info()


class Novel(Book):
    def __init__(self, title, author, year, genre):
        super().__init__(title, author, year)
        self.genre = genre

    def display_info(self):
        super().display_info()
        print(f"小说类型: {self.genre}")


novel1 = Novel("平凡的世界", "路遥", 1986, "现实主义小说")
novel1.display_info()